﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

using ZhimeiSoft.CharmManager.DOL;
using ZhimeiSoft.CharmManager.Server.BLL.Interface;
using ZhimeiSoft.CharmManager.Server.Factory;
using ZhimeiSoft.CharmManager.Server.DAL.Interface;

namespace ZhimeiSoft.CharmManager.Server.BLL
{
    public class CustomerServiceItemBLL: ICustomerServiceItemBLL
    {
        ICustomerServiceItemDAL itemDal;
        public CustomerServiceItemBLL()
        {
            itemDal = BaseDalFactory.CreateCustomerServiceItemDal();
        }

        public void InsertCustomerServiceItem(DBEntityCustomerServiceItem csi)
        {
            itemDal.InsertCustomerServiceItem(csi);
        }

        public void UpdateCustomerServiceItem(DBEntityCustomerServiceItem csi)
        {
            itemDal.UpdateCustomerServiceItem(csi);
        }

        public void UpdateLastServiceTime(int iCustomerServiceItemID, DateTime lastServiceTime)
        {
            itemDal.UpdateLastServiceTime(iCustomerServiceItemID, lastServiceTime);
        }

        public void DeleteCustomerServiceItem(int iCustomerServiceItemID)
        {
            itemDal.DeleteCustomerServiceItem(iCustomerServiceItemID);
        }

        public DataSet QueryCustomerServiceItem(string sFilter)
        {
            return itemDal.QueryCustomerServiceItem(sFilter);
        }
        /// <summary>
        /// 会员服务扣减
        /// </summary>
        /// <param name="customServiceItemID">服务项目ID</param>
        /// <param name="minusRemain">扣减次数</param>
        /// <param name="lastServiceTime">服务时间</param>
        /// <param name="cMemo">说明</param>
        /// <param name="employeeID">员工ID</param>
        /// <returns></returns>
        public void CompleteCustomServiceItem(int customServiceItemID, int minusRemain, string lastServiceTime,
            string cMemo, string employeeID, DBEntityCustomerServiceItem customerServiceItem, int reservationID)
        {
            itemDal.CompleteCustomServiceItem(customServiceItemID, minusRemain, lastServiceTime, cMemo, employeeID, customerServiceItem, reservationID);
        }

        /// <summary>
        /// 更新账号余额
        /// </summary>
        /// <param name="customerServiceItemID">会员服务项目ID</param>
        /// <param name="money">金额</param>
        public void UpdateAccountMoney(int customerServiceItemID, decimal money)
        {
            itemDal.UpdateAccountMoney(customerServiceItemID, money);
        }
        /// <summary>
        /// 根据用户疗程项目查询消费记录
        /// </summary>
        /// <param name="customServiceItemID"></param>
        /// <returns></returns>
        public DataSet QueryCustomServiceItemConsume(int customServiceItemID)
        {
            return itemDal.QueryCustomServiceItemConsume(customServiceItemID);
        }
        /// <summary>
        /// 根据用户预约记录查询扣减次数
        /// </summary>
        /// <param name="customServiceItemID"></param>
        /// <returns></returns>
        public DataSet QeuryCustomServiceItemConsumeReservationID(int reservationID)
        {
            return itemDal.QeuryCustomServiceItemConsumeReservationID(reservationID);
        }
        /// <summary>
        /// 删除会员服务项目检测
        /// </summary>
        /// <param name="customServiceItemID"></param>
        /// <returns></returns>
        public bool CheckDeleteCustomServiceItem(int customServiceItemID)
        {
            return itemDal.CheckDeleteCustomServiceItem(customServiceItemID);
        }
    }
}
